package com.lc.zpyh.ui.activity.home;

import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;

import com.hjq.bar.OnTitleBarListener;
import com.hjq.bar.TitleBar;
import com.lc.umeng.Platform;
import com.lc.umeng.UmengShare;
import com.lc.zpyh.R;
import com.lc.zpyh.app.AppActivity;
import com.lc.zpyh.ui.dialog.ShareDialog;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ArticleDetailsActivity extends AppActivity {
    @BindView(R.id.title_bar_top)
    TitleBar titleBarTop;
    @BindView(R.id.webView)
    WebView webView;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_articledetails;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
        titleBarTop.setOnTitleBarListener(new OnTitleBarListener() {
            @Override
            public void onLeftClick(View v) {
                finish();
            }

            @Override
            public void onTitleClick(View v) {

            }

            @Override
            public void onRightClick(View v) {
                new ShareDialog.Builder(ArticleDetailsActivity.this)
                        // 分享标题
                        .setShareTitle("Github")
                        // 分享描述
                        .setShareDescription("AndroidProject")
                        // 分享缩略图
                        .setShareLogo(R.mipmap.logo)
                        // 分享链接
                        .setShareUrl("https://github.com/getActivity/AndroidProject")
                        .setListener(new UmengShare.OnShareListener() {

                            @Override
                            public void onSucceed(Platform platform) {
                                toast("分享成功");
                            }

                            @Override
                            public void onError(Platform platform, Throwable t) {
                                toast("分享出错");
                            }

                            @Override
                            public void onCancel(Platform platform) {
                                toast("分享取消");
                            }
                        })
                        .show();
            }
        });
    }
}
